{% extends 'base.html' %}  

{% block title %}注册 - SaveStar{% endblock %}  

{% block page_title %}注册{% endblock %}  

{% block content %}  
<div class="row justify-content-center">  
    <div class="col-md-6">  
        <div class="card">  
            <div class="card-header">  
                <h4 class="mb-0">创建账户</h4>  
            </div>  
            <div class="card-body">  
                <form method="post">  
                    {% csrf_token %}  
                    <div class="mb-3">  
                        <label for="id_username" class="form-label">用户名</label>  
                        <input type="text" name="username" id="id_username" class="form-control" required>  
                        {% if form.username.errors %}  
                            <div class="text-danger">  
                                {% for error in form.username.errors %}  
                                    {{ error }}  
                                {% endfor %}  
                            </div>  
                        {% endif %}  
                    </div>  
                    <div class="mb-3">  
                        <label for="id_password1" class="form-label">密码</label>  
                        <input type="password" name="password1" id="id_password1" class="form-control" required>  
                        {% if form.password1.errors %}  
                            <div class="text-danger">  
                                {% for error in form.password1.errors %}  
                                    {{ error }}  
                                {% endfor %}  
                            </div>  
                        {% endif %}  
                    </div>  
                    <div class="mb-3">  
                        <label for="id_password2" class="form-label">确认密码</label>  
                        <input type="password" name="password2" id="id_password2" class="form-control" required>  
                        {% if form.password2.errors %}  
                            <div class="text-danger">  
                                {% for error in form.password2.errors %}  
                                    {{ error }}  
                                {% endfor %}  
                            </div>  
                        {% endif %}  
                    </div>  
                    <div class="d-grid gap-2">  
                        <button type="submit" class="btn btn-primary">注册</button>  
                    </div>  
                </form>  
            </div>  
            <div class="card-footer text-center">  
                <p class="mb-0">已有账户? <a href="{% url 'login' %}">登录</a></p>  
            </div>  
        </div>  
    </div>  
</div>  
{% endblock %}